package com.zsy.gateway.service;

import org.springframework.http.HttpCookie;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Service;

/**
 * @Description 获取权限相关数据
 * @Author zhaoshouyun
 * @Date 11:16 2020/4/19
 * @Param
 * @return
 **/
@Service
public class AuthService {

   // @Autowired
   // private StringRedisTemplate stringRedisTemplate;

    //从cookie中获取jti的值
    public String getJtiFromCookie(ServerHttpRequest request) {
        HttpCookie httpCookie = request.getCookies().getFirst("uid");
        if (httpCookie != null){
            String jti = httpCookie.getValue();
            return jti;
        }
        return null;
    }

    //从redis中获取jwt
    public String getJwtFromRedis(String jti) {
       /* String jwt = stringRedisTemplate.boundValueOps(jti).get();
        return jwt;*/
       return null;
    }
}
